<template>
  <button class="my-btn" :open-type="openType" hover-class="hover" :class="{ radius: radius }" :style="{
      width: width + 'rpx',
      height: height + 'rpx',
      fontSize: size + 'rpx',
      background: bgColor,
      color: color,
      border: border ? border : 'none',
      display: inline ? 'inline-flex' : 'flex'
    }"
    :disabled="disabled" @click="onClick">
    <slot></slot>
  </button>
</template>

<script>
  export default {
    props: {
      radius: {
        type: Boolean,
        default: false
      },
      width: {
        type: [Number, String],
        default: 670
      },
      height: {
        type: [Number, String],
        default: 88
      },
      size: {
        type: [Number, String],
        default: 36
      },
      inline: {
        type: Boolean,
        default: false
      },
      bgColor: {
        type: String,
        default: 'linear-gradient(90deg, #E1A55E, #FED6A6)'
      },
      color: {
        type: String,
        default: '#fff'
      },
      border: {
        type: String,
        default: ''
      },
      disabled: {
        type: Boolean,
        default: false
      },
      openType: {
        type: String,
        default: ''
      },
    },
    data() {
      return {

      };
    },
    methods: {
      onClick() {
        this.$emit('click', 1)
      }
    }
  }
</script>

<style lang="scss">
  .my-btn {
    font-family: Alibaba PuHuiTi;
    font-weight: 500;
    letter-spacing: 2rpx;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;

    &::after {
      border: none;
    }

    &.hover {
      opacity: 0.9;
    }

    &.radius {
      border-radius: 44rpx;
    }

    &[disabled] {
      color: #fff;
      filter: grayscale(0.8);
    }
  }
</style>
